<html>

<head>
<meta charset='UTF-8'>
<meta name=标题 content="">
<meta name=关键词 content="">
<meta http-equiv=Content-Type content="text/html; charset=x-mac-chinesesimp">
<meta name=Generator content="Microsoft Word 14 (filtered)">
<style>
<!--
 /* Font Definitions */
@font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Cambria;
	panose-1:2 4 5 3 5 4 6 3 2 4;}
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:12.0pt;
	font-family:Cambria;}
h1
	{margin-top:17.0pt;
	margin-right:0cm;
	margin-bottom:16.5pt;
	margin-left:0cm;
	text-align:justify;
	text-justify:inter-ideograph;
	line-height:240%;
	font-size:22.0pt;
	font-family:Cambria;}
h2
	{margin-top:13.0pt;
	margin-right:0cm;
	margin-bottom:13.0pt;
	margin-left:0cm;
	text-align:justify;
	text-justify:inter-ideograph;
	line-height:173%;
	font-size:16.0pt;
	font-family:Calibri;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
	{margin-top:12.0pt;
	margin-right:0cm;
	margin-bottom:3.0pt;
	margin-left:0cm;
	text-align:center;
	font-size:16.0pt;
	font-family:Calibri;
	font-weight:bold;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:21.0pt;
	font-size:12.0pt;
	font-family:Cambria;}
p.a, li.a, div.a
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:10.0pt;
	margin-left:0cm;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:10.0pt;
	line-height:115%;
	font-size:10.0pt;
	font-family:Cambria;}
span.1
	{font-weight:bold;}
span.a0
	{font-family:Calibri;
	font-weight:bold;}
span.2
	{font-family:Calibri;
	font-weight:bold;}
.MsoChpDefault
	{font-family:Cambria;}
 /* Page Definitions */
@page WordSection1
	{size:595.0pt 842.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	layout-grid:15.6pt;}
div.WordSection1
	{page:WordSection1;}
 /* List Definitions */
ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
-->
</style>

</head>

<body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'>

<div class=WordSection1 style='layout-grid:15.6pt'>

<p class=MsoTitle><span style='font-family:宋体'>开始在</span><span lang=EN-US>iOS</span><span
style='font-family:宋体'>上使用</span><span lang=EN-US>XMPPFramework</span><span
style='font-family:宋体'>框架</span></p>

<h1><span style='font-family:宋体'>简介</span></h1>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>在提供的</span><span
lang=EN-US>Xcode</span><span style='font-family:宋体'>示例项目中，包含有在</span><span
lang=EN-US>iOS</span><span style='font-family:宋体'>中使用</span><span lang=EN-US>XMPPFramework</span><span
style='font-family:宋体'>的演示项目。您可以在</span><span lang=EN-US>Xcode/iPhoneXMPP</span><span
style='font-family:宋体'>文件夹中找到它。该项目的设计并不是为了演示一个完整的商业应用，而仅是为了演示如何使用</span><span
lang=EN-US>XMPPFramework</span><span style='font-family:宋体'>框架，并提供有</span><span
lang=EN-US>iOS</span><span style='font-family:宋体'>平台上需要使用的具体代码。您可以随意修改及测试该项目，并浏览</span><span
lang=EN-US>AppDelegate</span><span style='font-family:宋体'>文件中的代码。提示，该示例程序仅使用了框架中的一小部分功能。</span></p>

<p class=MsoNormal><span style='font-family:宋体'>本文档提供了如何将</span><span
lang=EN-US>XMPPFramework</span><span style='font-family:宋体'>框架添加到</span><span
lang=EN-US>iOS</span><span style='font-family:宋体'>项目的详细说明，您也可以参照</span><span
lang=EN-US>iPhoneXMPP</span><span style='font-family:宋体'>项目中的具体引用。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>提示：请按照以下步骤逐一执行，而不要省略或者跳过某个步骤。</span></p>

<h1><span style='font-family:宋体'>第一步</span></h1>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>使用源代码管理器检出最新版本的项目。默认的分支包含有最新稳定版本的代码。</span></p>
<p class=MsoNormal style='text-indent:21.0pt'>github地址:https://github.com/robbiehanson/XMPPFramework</p>
<p class=MsoNormal style='text-indent:21.0pt'>下载对应的压缩包并解压缩</p>
<h1><span style='font-family:宋体'>第二步</span></h1>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>尽管本框架包含有对其他项目的依赖，不过您已无需再使用</span><span
lang=EN-US>git</span><span style='font-family:宋体'>去分别克隆这些项目。在克隆</span><span
lang=EN-US>XMPPFramework</span><span style='font-family:宋体'>框架的同时，这些项目会被同时克隆并保存在</span><span
lang=EN-US>Vendor</span><span style='font-family:宋体'>文件夹中。接下来，我们将逐一确认每一个依赖，以确保在完成最后一步工作之后，能够正常编译项目。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>第一个依赖是</span><span
lang=EN-US style='color:red;border:solid windowtext 1.0pt;padding:0cm'><a
href="https://github.com/robbiehanson/CocoaLumberjack"><span style='color:red'>CocoaLumberjack</span></a></span><span
style='font-family:宋体'>，这是</span><span lang=EN-US>XMPPFramework</span><span
style='font-family:宋体'>框架使用的日志框架。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>（有关日志框架的进一步信息，可以参见</span><span
lang=EN-US>XMPPFramework</span><span style='font-family:宋体'>的介绍文档，另外在</span><span
lang=EN-US>Lumberjack</span><span style='font-family:宋体'>的项目主页中也提供有大量的文档。）</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>将</span><span
lang=EN-US>Vendor/CocoaLumberjack</span><span style='font-family:宋体'>复制并添加入</span><span
lang=EN-US>Xcode</span><span style='font-family:宋体'>项目。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US>Lumberjack</span><span
style='font-family:宋体'>不包含任何子依赖或特殊要求的框架。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>现在，请确认您的项目可以正常编译。</span></p>

<h1><span style='font-family:宋体'>第三步</span></h1>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>第二个依赖是</span><span
lang=EN-US style='color:red;border:solid windowtext 1.0pt;padding:0cm'>CocoaAsyncSocket</span><span
style='font-family:宋体'>，这是</span><span lang=EN-US>XMPPFramework</span><span
style='font-family:宋体'>框架使用的底层网络框架。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>将</span><span
lang=EN-US>Vendor/CocoaAsyncSocket</span><span style='font-family:宋体'>复制并添加入</span><span
lang=EN-US>Xcode</span><span style='font-family:宋体'>项目。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>要使用此依赖，需要将苹果的</span><b><span
lang=EN-US style='color:red;border:solid windowtext 1.0pt;padding:0cm'>CFNetwork</span></b><span
style='font-family:宋体'>框架添加到项目。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>要使用此依赖，还需要将苹果的</span><b><span
lang=EN-US style='color:red;border:solid windowtext 1.0pt;padding:0cm'>Security</span></b><span
style='font-family:宋体'>框架添加到项目。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>现在，请确认您的项目可以正常编译。</span></p>

<h1><span style='font-family:宋体'>第四步</span></h1>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>第三个依赖是</span><span
lang=EN-US style='color:red;border:solid windowtext 1.0pt;padding:0cm'>KissXML</span><span
style='font-family:宋体'>，由于苹果并没有针对</span><span lang=EN-US>iOS</span><span
style='font-family:宋体'>提供</span><span lang=EN-US>NSXML</span><span
style='font-family:宋体'>类以处理</span><span lang=EN-US>NSXMLDocument</span><span
style='font-family:宋体'>、</span><span lang=EN-US>NSXMLElement</span><span
style='font-family:宋体'>、</span><span lang=EN-US>NSXMLNode</span><span
style='font-family:宋体'>，因此我们使用</span><span lang=EN-US>KissXML</span><span
style='font-family:宋体'>取而代之。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>将</span><span
lang=EN-US>Vendor/KissXML</span><span style='font-family:宋体'>复制并添加入</span><span
lang=EN-US>Xcode</span><span style='font-family:宋体'>项目。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>由于</span><span
lang=EN-US>KissXML</span><span style='font-family:宋体'>内部使用到</span><span
lang=EN-US style='color:red;border:solid windowtext 1.0pt;padding:0cm'>libxml2</span><span
style='font-family:宋体'>。因此还需要告诉</span><span lang=EN-US>Xcode</span><span
style='font-family:宋体'>在哪里可以找到</span><span lang=EN-US>libxml2</span><span
style='font-family:宋体'>的头文件，并且在编译完成后链接</span><span lang=EN-US>libxml2</span><span
style='font-family:宋体'>编译库。要做到这两点，在项目的编译设置中设置以下两条编译指令即可：</span></p>

<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:0cm'><span
lang=EN-US style='color:red;border:solid windowtext 1.0pt;padding:0cm'>1. Other
Link Flags = -lxml2</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US
style='color:red;border:solid windowtext 1.0pt;padding:0cm'>2. Header Search
Paths = /usr/include/libxml2</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>执行完上述操作后，请确认您的项目可以正常编译。</span></p>

<h1><span style='font-family:宋体'>第五步</span></h1>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>第四个以及最后一个依赖是</span><span
lang=EN-US>libidn</span><span style='font-family:宋体'>。将以下文件添加到项目中：</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US
style='color:red;border:solid windowtext 1.0pt;padding:0cm'>Vendor/libidn/idn-int.h</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US
style='color:red;border:solid windowtext 1.0pt;padding:0cm'>Vendor/libidn/stringprep.h</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US
style='color:red;border:solid windowtext 1.0pt;padding:0cm'>Vendor/libidn/libidn.a</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>上述最后一个文件</span><span
lang=EN-US>libidn.a</span><span style='font-family:宋体'>是一个静态库，支持包括：</span><span
lang=EN-US>x86*64</span><span style='font-family:宋体'>、</span><span lang=EN-US>i386</span><span
style='font-family:宋体'>、</span><span lang=EN-US>ppc</span><span
style='font-family:宋体'>、</span><span lang=EN-US>armv6</span><span
style='font-family:宋体'>、</span><span lang=EN-US>armv7</span><span
style='font-family:宋体'>等多种架构。因而该文件的个头也不小，大约有</span><span lang=EN-US>1.7M</span><span
style='font-family:宋体'>。但是不用担心，编译器会在编译时仅提取架构所需的内容，并且只会提取被使用的那一部分，而由于框架中仅仅只用到了该静态库中很小的一部分内容。换言之，该静态库的使用不会明显增加您应用程序的大小！</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>注释：</span><span
lang=EN-US>libidn</span><span style='font-family:宋体'>的源代码包含在</span><span
lang=EN-US>libidn-1.15.tar.gz</span><span style='font-family:宋体'>中。不过很显然，没有必要将其添加到项目之中。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>执行完上述操作后，请确认您的项目可以正常编译。</span></p>

<h1><span style='font-family:宋体'>第六步</span></h1>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>将以下文件夹复制并添加入</span><span
lang=EN-US>Xcode</span><span style='font-family:宋体'>项目：</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US
style='color:red;border:solid windowtext 1.0pt;padding:0cm'>Authentication</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US
style='color:red;border:solid windowtext 1.0pt;padding:0cm'>Categories</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US
style='color:red;border:solid windowtext 1.0pt;padding:0cm'>Core</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US
style='color:red;border:solid windowtext 1.0pt;padding:0cm'>Utilities</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>另外，还需将</span><span
lang=EN-US style='color:red;border:solid windowtext 1.0pt;padding:0cm'>libresolv.dylib</span><span
style='font-family:宋体'>添加至</span><span lang=EN-US>Xcode</span><span
style='font-family:宋体'>项目。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>执行完上述操作后，请确认您的项目可以正常编译。</span></p>

<p class=MsoNormal style='text-indent:21.0pt'><span style='font-family:宋体'>至此，您已经准备好在项目中使用</span><span
lang=EN-US>XMPPFramework</span><span style='font-family:宋体'>框架了。后续的相关操作请参见：</span><span
lang=EN-US>Intro to XMPPFramework</span><span style='font-family:宋体'>文档。</span></p>

</div>

</body>

</html>
